﻿@model BMS.ViewModels.FMModelList

@{
    ViewBag.Title = "Facility Maintenance";
}

@section featured {
    <section class="featured">
        <div class="content-wrapper" align="center">
            <hgroup class="title">
                <h1>@ViewBag.Message</h1>
            </hgroup>
        </div>
    </section>
}

<section id="loginForm">
    <h2>New FM Registration</h2>
    <br />
    @using (Html.BeginForm("CreateFM", "Maintenance"))
    {
        <fieldset>
            <table border="0">
                <tr>
                    <td align="right">@Html.LabelFor(m => m.fm.FMCode)</td>
                    <td align="left">@Html.TextBoxFor(m => m.fm.FMCode, new { style = "width:100px" })</td>
                </tr>
                <tr>
                    <td align="right">@Html.LabelFor(m => m.fm.AttentionTo)</td>
                    <td align="left">@Html.TextBoxFor(m => m.fm.AttentionTo, new { style = "width:250px" })</td>
                </tr>
                <tr>
                    <td align="right">@Html.LabelFor(m => m.fm.CompanyName)</td>
                    <td align="left">@Html.DropDownList("CompanyNameSV", Model.companyList, "")</td>
                </tr>
            </table>
            <br />
            <input type="submit" value="Create" />
        </fieldset>
        
        @*@Html.ValidationSummary(true)
        <fieldset>
            @Html.LabelFor(m => m.fm.FMCode)
            @Html.TextBoxFor(m => m.fm.FMCode)
            @Html.ValidationMessageFor(m => m.fm.FMCode)
            <input type="submit" value="Create" />
        </fieldset>*@
    }
    @using (Html.BeginForm("BackToMainMeun", "Home"))
    {
        <br />
        <input type="submit" value="Back To Main Menu" />
    }
</section>

<section class="social" id="socialLoginForm">
    <h2>Existing FMs</h2>
    @if (Model.fmList.Count > 0)
    {
        <br align="center" />
        <table class="sample">
            <thead>
                <tr>
                    <th width="80">FM Code</th>
                    <th width="100">FM Name</th>
                    <th width="100">Attn To</th>
                    <th width="400">Company Name</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.fmList)
                {
                    <tr>
                        <td align="center">@item.FMCode</td>
                        <td align="center">@item.FMName</td>
                        <td align="center">@item.AttentionTo</td>
                        <td align="center">@item.CompanyName</td>
                    </tr>
                }
            </tbody>
        </table>
    }
</section>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}